using System.Collections.Generic;
using UnityEngine;

public class FSMServiceiBase
{
    public FSM player;

    public virtual void Init(FSM fSM)
    {
        player = fSM;
    }

    public virtual void OnBegin(PlayerState state)
    {

    }

    public virtual void OnUpdate(float normalizedTime, PlayerState state)
    {
    }

    public virtual void OnEnd(PlayerState state)
    {

    }


    public virtual void OnAnimationEnd(PlayerState state)
    {
        
    }

    //重新播动画的时候调用这个 
    public virtual void ReStart(PlayerState state)
    {

    }

    //重新循环 
    public virtual void ReLoop(PlayerState state)
    {

    }

    public virtual void OnDisable(PlayerState state)
    {

    }


    public Dictionary<int,bool>executed = new Dictionary<int,bool>();

    public void SetExcuted(int index)
    {
        executed[index] = true;
    }


    public void ReSetExcuted(int index)
    {
        executed[index] = false;
    }


    public void ReSetAllExcuted()
    {
        if (executed.Count > 0)
        {
            executed.Clear();
        }
    }

    public bool GetExecuted(int index)
    {
        if(executed.TryGetValue(index, out bool result)) return result;
        return false;
    }





}
